package cn.hrlly.tao2shou.presenter;

import android.content.Context;

import cn.hrlly.tao2shou.biz.QueryUserInfoBiz;
import cn.hrlly.tao2shou.biz.QueryUserInfoBizImpl;
import cn.hrlly.tao2shou.domain.User;
import cn.hrlly.tao2shou.listener.OnQueryUserInfoListener;
import cn.hrlly.tao2shou.view.view_interface.QueryUserInfoView;

/**
 * User: gengliang
 * Date: 2016-01-31
 * Time: 19:25
 */

public class QueryUserInfoPresenterImpl implements QueryUserInfoPresenter,OnQueryUserInfoListener {

    private QueryUserInfoBiz queryUserInfoBiz;
    private QueryUserInfoView queryUserInfoView;

    public QueryUserInfoPresenterImpl(QueryUserInfoView queryUserInfoView,Context context) {
        this.queryUserInfoView = queryUserInfoView;
        this.queryUserInfoBiz=new QueryUserInfoBizImpl(this,context);
    }

    @Override
    public void queryUserInfo() {
        queryUserInfoBiz.queryUserInfoBiz();
    }

    @Override
    public void closeDataBase() {
        queryUserInfoBiz.closeDataBase();
    }

    @Override
    public void queryUserInfoSucc(User user) {
        queryUserInfoView.showUserInfo(user);
    }

    @Override
    public void queryUserInfoFail(int errorMessage) {
        queryUserInfoView.showMessage(errorMessage);
    }

    @Override
    public void queryUserInfoFail(String errorMessage) {
        queryUserInfoView.showMessage(errorMessage);
    }
}
